package com.ocom.webapi.service.impl;

import com.ocom.common.entity.access.EntityMjYkm;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.common.utils.StringUtils;
import com.ocom.webapi.feign.AccessClientService;
import com.ocom.webapi.service.YkmService;
import com.ocom.webapi.vo.access.MjYkmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class YkmServiceImpl implements YkmService {
    @Autowired
    private AccessClientService accessClientService;
    /**
     * 获取粤康码规则信息（Ykm/info）
     * */
    @Override
    public Result YkmInfo(Long comId, Long areaId) {
        return accessClientService.YkmInfo(comId,areaId);
    }

    //添加/修改粤康码规则信息（Ykm/modify）
    @Override
    public Result YkmModify(MjYkmVo mjYkmVo) {
        EntityMjYkm entityMjYkm = new EntityMjYkm();
        if (StringUtils.isNotNull(mjYkmVo.getComId())){
            entityMjYkm.setComId(mjYkmVo.getComId());
        }
        if (StringUtils.isNotNull(mjYkmVo.getAreaId())){
            entityMjYkm.setAreaId(mjYkmVo.getAreaId());
        }
        if (StringUtils.isNotNull(mjYkmVo.getIsEnable())){
            entityMjYkm.setIsEnable(mjYkmVo.getIsEnable());
        }
        if (StringUtils.isNotNull(mjYkmVo.getColor())){
            entityMjYkm.setColor(mjYkmVo.getColor());
        }
        if (StringUtils.isNotNull(mjYkmVo.getColorRed())){
            entityMjYkm.setColorRed(mjYkmVo.getColorRed());
        }
        if (StringUtils.isNotNull(mjYkmVo.getColorYellow())){
            entityMjYkm.setColorYellow(mjYkmVo.getColorYellow());
        }
        if (StringUtils.isNotNull(mjYkmVo.getColorGreen())){
            entityMjYkm.setColorGreen(mjYkmVo.getColorGreen());
        }
        if (StringUtils.isNotNull(mjYkmVo.getCheckResource())){
            entityMjYkm.setCheckResource(mjYkmVo.getCheckResource());
        }
        if (StringUtils.isNotNull(mjYkmVo.getCheckResourceYin())){
            entityMjYkm.setCheckResourceYin(mjYkmVo.getCheckResourceYin());
        }
        if (StringUtils.isNotNull(mjYkmVo.getCheckResourceYang())){
            entityMjYkm.setCheckResourceYang(mjYkmVo.getCheckResourceYang());
        }
        if (StringUtils.isNotNull(mjYkmVo.getIsTemperature())){
            entityMjYkm.setIsTemperature(mjYkmVo.getIsTemperature());
        }

        if (StringUtils.isNotNull(mjYkmVo.getTemperature())){
            entityMjYkm.setTemperature(mjYkmVo.getTemperature());
        }
        if (StringUtils.isNotNull(mjYkmVo.getCheckRange())) {
            entityMjYkm.setCheckRange(mjYkmVo.getCheckRange());
        }
        if (StringUtils.isNotNull(mjYkmVo.getIsCheckRange())) {
            entityMjYkm.setIsCheckRange(mjYkmVo.getIsCheckRange());
        }

        if (StringUtils.isNotNull(mjYkmVo.getIsHighRisk())) {
            entityMjYkm.setIsHighRisk(mjYkmVo.getIsHighRisk());
        }

        if (StringUtils.isNotNull(mjYkmVo.getHighRisk())) {
            entityMjYkm.setHighRisk(mjYkmVo.getHighRisk());
        }

        if (StringUtils.isNotNull(mjYkmVo.getUseSys())) {
            entityMjYkm.setUseSys(mjYkmVo.getUseSys());
        }
        if (StringUtils.isNotNull(mjYkmVo.getIsSkip())) {
            entityMjYkm.setIsSkip(mjYkmVo.getIsSkip());
        }
        if (StringUtils.isNotNull(mjYkmVo.getTitle())) {
            entityMjYkm.setTitle(mjYkmVo.getTitle());
        }
        return accessClientService.YkmModify(entityMjYkm);
    }
}
